//
//  ViewController.swift
//  iBeacon
//
//  Created by 郭颢源 on 2021/4/8.
//

import UIKit

class ViewController: UIViewController {
    lazy var btn : UIButton = {
        var _btn = UIButton(type: .custom)
        _btn.backgroundColor = .systemBlue
        _btn.frame = CGRect(origin: .zero, size: CGSize(width: 150, height: 40))
        _btn.center = view.center
        _btn.setTitle("广播beacon消息", for: .normal)
        _btn.addTarget(self, action: #selector(click), for: .touchUpInside)
        return _btn
    }()
    lazy var btn1 : UIButton = {
        var _btn = UIButton(type: .custom)
        _btn.backgroundColor = .systemRed
        
        
        _btn.frame = CGRect(origin: .zero, size: CGSize(width: 150, height: 40))
        var center = CGPoint(x: view.center.x, y: view.center.y+60)
        _btn.center = center
        _btn.setTitle("监听beacon消息", for: .normal)
        _btn.addTarget(self, action: #selector(click1), for: .touchUpInside)
        return _btn
    }()
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        view.addSubview(btn)
        view.addSubview(btn1)
    }

    @objc func click() {
        self.navigationController?.pushViewController(Advertising(), animated: true)
        
    }
    @objc func click1() {
        self.navigationController?.pushViewController(Monitoring(), animated: true)
    }
}

